<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>
<style>
    .shenren{display: none}
</style>

<body id="optPage">
<form class="layui-form layui-form-pane" id="commentForm">
    <div class="page-title"><div class="page-title-con"><span>新建发文</span><div class="move_title"></div><?php include "../public/sub.php";?></div></div>
    <div class="main-container">

        <div class="block-generic">


            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="edittits"><span>基本信息</span></div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>拟办发文</label>
                        <div class="layui-input-block">
                            <input type="text" readonly name="banid" class="layui-input banid" onclick="openPage('../public/choose_wen_ban.php?dom=banid&page=wen_fa','80%','80%')">
                            <div class="choose_div" id="banid" key="1"></div>
                            <span class="choose_one" onclick="openPage('../public/choose_wen_ban.php?dom=banid&page=wen_fa','80%','80%')"><i class="layui-icon layui-icon-search"></i></span>
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">公文类型</label>
                        <div class="layui-input-block">
                            <input type="text" id="wentype" readonly autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">发文字号</label>
                        <div class="layui-input-block">
                            <input type="text" id="wenzi" readonly autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">公文编号</label>
                        <div class="layui-input-block">
                            <input type="text" id="number" readonly autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">公文秘级</label>
                        <div class="layui-input-block">
                            <input type="text" id="wenlevel" readonly autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">紧急程度</label>
                        <div class="layui-input-block">
                            <input type="text" id="wenjin" readonly autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">标题</label>
                        <div class="layui-input-block">
                            <input type="text" id="title" readonly autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">主题词</label>
                        <div class="layui-input-block">
                            <input type="text" id="zhuti" readonly autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">发文单位</label>
                        <div class="layui-input-block">
                            <input type="text" id="deptid_name" readonly autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label">主送单位</label>
                        <div class="layui-input-block">
                            <input type="text" id="zhudept_name" readonly autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md6">
                        <label class="layui-form-label">抄送单位</label>
                        <div class="layui-input-block">
                            <input type="text" id="chaodept_name" readonly autocomplete="off" class="layui-input disabled">
                        </div>
                    </div>
                    <div class="layui-col-md6">
                        <label class="layui-form-label"><text>*</text>发文日期</label>
                        <div class="layui-input-block">
                            <input type="text" name="dt" id="dt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-form-item height_auto">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md12">
                        <label class="layui-form-label label_textarea">摘要</label>
                        <div class="layui-input-block">
                            <textarea id="explain" name="explain" placeholder="请输入" class="layui-textarea"></textarea>
                        </div>
                    </div>
                </div>
            </div>

            <?php include '../public/upinfo.php'?>
        </div>


    </div>
</form>
<script>


    $("#commentForm").validate({
        rules: {
            dt: {required: true},
        },
        messages:{
            dt: {required: "请选择"},
        }
    });


    var jietype;
    layui.use(['laytp', 'form'], function() {
        var form = layui.form, layer = layui.layer;
        render_input_attr();

        facade.ajax({type: 'get', url: ask_wen_fa_add}).done(function(res){
            if (res.code === 2000) {
                var data = res.data;
                $("#dt").val(data.dt);

                public_upload_file_load('upload_files');
                render_date();
                render_from();
            }
        });

        form.on('submit(add)', function(data){


            var validRes = $("#commentForm").valid();


            data.field.banid = get_choose_val('banid');
            formValid('banid');
            if(data.field.banid == undefined || !data.field.banid){
                validRes = false;
            }

            if(!validRes){return false;}





            data.field.files = public_upload_file_value('upload_files');
            facade.ajax({url: ask_wen_fa_add, data:data.field}).done(function(res){
                if (res.code === 2000) {
                    dataPostTimeOut();
                }
            });

            return false;
        });

    });


</script>
</body>
</html>
